package lesson2;

public class Demo1 {
    public static void main(String[] args) {
        //OnlyOnePerson onlyOnePerson = new OnlyOnePerson();
//        Person onlyOnePerson = new Person() {
//            @Override
//            public void eat() {
//                System.out.println("我万中无一...,只有我是这样");
//            }
//        };

        class OnlyPerson extends Person{

            @Override
            public void eat() {
                System.out.println("我万中无一...,只有我是这样");
            }
        }

        OnlyPerson onlyPerson2 = new OnlyPerson();

        Person onlyPerson = new Person(){

            @Override
            public void eat() {
                System.out.println("我万中无一...,只有我是这样，我是匿名内部类");
            }
        };
        onlyPerson.eat();

    }
}
